package com.ruoyi.web.controller.system;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.AdminAgentStatic;
import com.ruoyi.system.service.IAdminAgentStaticService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 总金额统计Controller
 * 
 * @author ruoyi
 * @date 2020-11-11
 */
@RestController
@RequestMapping("/system/agentStatic")
public class AdminAgentStaticController extends BaseController
{
    @Autowired
    private IAdminAgentStaticService adminAgentStaticService;

    /**
     * 查询总金额统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:agentStatic:list')")
    @GetMapping("/list")
    public TableDataInfo list(AdminAgentStatic adminAgentStatic)
    {
        startPage();
        List<AdminAgentStatic> list = adminAgentStaticService.selectAdminAgentStaticList(adminAgentStatic);
        return getDataTable(list);
    }

    /**
     * 导出总金额统计列表
     */
    @PreAuthorize("@ss.hasPermi('system:agentStatic:export')")
    @Log(title = "总金额统计", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(AdminAgentStatic adminAgentStatic)
    {
        List<AdminAgentStatic> list = adminAgentStaticService.selectAdminAgentStaticList(adminAgentStatic);
        ExcelUtil<AdminAgentStatic> util = new ExcelUtil<AdminAgentStatic>(AdminAgentStatic.class);
        return util.exportExcel(list, "agentStatic");
    }

    /**
     * 获取总金额统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:agentStatic:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(adminAgentStaticService.selectAdminAgentStaticById(id));
    }

    /**
     * 新增总金额统计
     */
    @PreAuthorize("@ss.hasPermi('system:agentStatic:add')")
    @Log(title = "总金额统计", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AdminAgentStatic adminAgentStatic)
    {
        return toAjax(adminAgentStaticService.insertAdminAgentStatic(adminAgentStatic));
    }

    /**
     * 修改总金额统计
     */
    @PreAuthorize("@ss.hasPermi('system:agentStatic:edit')")
    @Log(title = "总金额统计", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AdminAgentStatic adminAgentStatic)
    {
        return toAjax(adminAgentStaticService.updateAdminAgentStatic(adminAgentStatic));
    }

    /**
     * 删除总金额统计
     */
    @PreAuthorize("@ss.hasPermi('system:agentStatic:remove')")
    @Log(title = "总金额统计", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(adminAgentStaticService.deleteAdminAgentStaticByIds(ids));
    }
}
